	<!--
	设备录入
-->
<style>
	.vice-pagemain {
		width: 700px;
		height: auto;
		margin: 0 auto;
	}
	
	.vice-table {
		width: 450px;
		height: 400px;
		margin: 0 auto;
	}
	
	tr:hover {
		background: none;
	}
	
	.vice-table tr {
		height: 20px;
		width: 100%;
		font-size: 18px;
		font-weight: 300;
	}
	
	input {
		width: 200px;
		height: 30px;
		font-size: 15px;
		border: 1px solid #28A4C9;
	}
	
	input:hover {
		-moz-box-shadow: 0px 0px 3px #C0C0C0;
		-webkit-box-shadow: 0px 0px 3px #C0C0C0;
		box-shadow: 0px 0px 3px #C0C0C0;
	}
	
	.vice-button {
		width: 700px;
		height: 50px;
		margin: 0 auto;
		margin-top: 40px;
	}
	
	.vice-button button {
		background: #5a98de;
		border: 1px solid #5a98de;
		border-radius: 5px;
		width: 80px;
		height: 35px;
		margin-left: 180px;
		color: white;
	}
	
	.vice-button button:hover {
		background: #2e6da4;
	}
</style>

<div>
	<div class="addPS-div1">
		<p>
			<img src="../Static/img/设置.png" /> &nbsp;设备管理
			<img class="arrowsright" src="../Static/img/箭头右.png" /> &nbsp;设备录入
		</p>
		<button>刷新</button>
	</div>
	<form id="equipmentInfo">
		<div class="vice-pagemain">
			<table class="vice-table">
				<tr>
					<th>设备序列号 ：</th>
					<th><input type="text" name="equipSequence" value="" /></th>
				</tr>
				<tr>
					<th>设备名称 ：</th>
					<th><input type="text" name="equipName" value="" /></th>
				</tr>
				<tr>
					<th>设备图片 ：</th>
					<th><input type="text" name="equipImgur" value="" /></th>
				</tr>
				<tr>
					<th>设备状态 ：</th>
					<th>
						<select style="width:200px;height: 30px;border: 1px solid #28A4C9" name="equipState">
							<option value=1>待机</option>
							<option value=2>运行</option>
							<option value=3>故障</option>
							<option value=4>停机</option>
							<option value=-1>失效</option>
						</select>
					</th>
				</tr>
				<tr>
					<th>可生产产品 ：</th>
					<th>
						<select class="SelectPro" style="width:200px;height: 30px;border: 1px solid #28A4C9" name="equipProduct.proName"></select>
					</th>
				</tr>
				<tr>
					<th>产能 ：</th>
					<th><input type="text" name="equipCapacity" value="" /></th>
				</tr>
				<tr>
					<th>工廠 ：</th>
					<th>
						<select id="SelectFactory" style="width:200px;height: 30px;border: 1px solid #28A4C9" name="equipfactory.fName"></select>
					</th>
				</tr>
			</table>
			<div class="vice-button">
				<button id="SureAdd" type="button">确认录入</button>
				<button>重置</button>
			</div>
		</div>
	</form>
</div>
<script>
	$(function() {
		$("#SureAdd").click(function(){
			$.ajax({
				type:"post",
				data:$("#equipmentInfo").serialize(),
				url:"/equipment/add",
				dataType:"json",
				success:function(obj){
					if(obj==1){
						alert("錄入成功");
					}
					else if(obj.code==1){
						
						
					}else if(obj.code==1000){
						alert(obj.msg);
					}else{
						alert("未知錯誤");
					}
				}
			})
		})
		$.ajax({
			type: "get",
			url: "/product/productAllState.do",
			dataType: 'json',
			success: function(obj) {
				var data = obj.data
				var $SelectPro = $(".SelectPro")
				$SelectPro.empty()
				for(var i = 0; i < data.length; i++) {
					$SelectPro.append("<option>" + data[i].proName + "</option>")
				}
			}
		});
		
		 $.ajax({
            type: "get",
            url: "/factory/factorysByState.do",
            dataType: 'json',
            success: function (obj) {
                var data = obj.data
                var $SelectFactory = $("#SelectFactory")
                $SelectFactory.empty()
                for (var i = 0; i < data.length; i++) {
                    $SelectFactory.append("<option>" + data[i].fName + "</option>")
                }
            }
        });
	})
</script>





